import network 
import time

def ConnectWiFi():
  sta_if = network.WLAN(network.STA_IF)
  sta_if.active(True)
  sta_if.connect("ChinaNet-HJEw","wifi-pwd")
  while not sta_if.isconnected():
    print("connecting to wifi...")
    time.sleep(2)
  return sta_if